<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<title>用户登录界面</title>
	
</head>
<body>
<?php
    $username=isset($_POST['username'])?htmlspecialchars($_POST['username']):'';
    $pwd=isset($_POST['pwd'])?htmlspecialchars($_POST['pwd']):'';
    $conn=mysqli_connect('localhost','root','123456');
    mysqli_select_db($conn,'usermessage');
    $sql="select * form userinfo where username='$username',pwd='$pwd'";
    $row=mysqli_query($conn,$sql);
    $rnum=mysqli_num_rows($row);
    if ($rnum<1) 
    {
    	echo "用户名或密码错误";
    }else{
    	echo "登录成功";
    }

 ?>
<script type="text/javascript">
		function add() {
            $("#myform").attr("action", "reg.php").submit();
            }
	</script>
    <form method="post">
    <div>
    	<div>用户名：<input type="text" name="username"></div>
    	<div>密码：<input type="password" name="pwd"></div>
    	<div><input type="submit" name="login" value="登录"></div>
    	<div><a href="reg.php">注册</a></div>
    </div>
    </form>
</body>
</html>